package com.shuai.reqeust;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/demo03Request")
public class Demo03Request extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //演示获取请求头的数据：refer
        String referer = request.getHeader("referer");
        System.out.println(referer);
        if (referer!=null){
            if (referer.contains("/day11")){
                System.out.println("播放电影");
            }else{
                System.out.println("你的连接不合法");
            }
        }
    }
}
